package cn.sytton.taffecloud.common.servlet.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;

/**
 * TokenFilter配置
 *
 * @author skyrock
 */
@Configuration
public class TokenFilterConfig {

    @Bean
    public FilterRegistrationBean<TokenFilter> requestBodyBean(){

        FilterRegistrationBean<TokenFilter> bean = new FilterRegistrationBean<>();

        bean.setName("TokenFilter");
        bean.setFilter(new TokenFilter());
        bean.addUrlPatterns("/*");  //过滤所有请求
        bean.setOrder(Ordered.HIGHEST_PRECEDENCE);

        return bean;
    }
}
